$(document).ready(function(){
	
	$("#UploadFile").click(function(e){
		e.preventDefault();
		$("input[name='cv']").trigger('click');
	});
		
	$("#registrationForm").submit(function(){
		
		var uploadedFile	=	$("#Upload").val();
		var file_ext		=	uploadedFile.split('.')[1];

		if (uploadedFile == undefined || uploadedFile == '')
		{
			$("#error").addClass("UploadError").html("Please upload file.");
			$("#error").prepend("<img src='public/images/close.png' id='close_image' />");
			return false;
		}
		if($.inArray(file_ext,file_formats) == -1){
			$("#error").addClass("UploadError").html("Please upload valid file.");
			$("#error").prepend("<img src='public/images/close.png' id='close_image' />");
			return false;
		}
		return true;
	});
	
	$("#close_div").click(function(e){
		e.preventDefault();
        $("#notice").slideUp('slow');
	});
	
	$("#error").click(function (e) {
		e.preventDefault();
        $("#error").slideUp('slow');
    });
	
	$("input[type='radio']").first().click();
	$("input[type='radio']").click(function(){
		var email_val = $(this).data("radiovalue");
   		$("#email_textbox").val(email_val)
	});
});